package com.example.mentalhealth.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 映射/images/开头的请求到静态资源目录
        registry.addResourceHandler("/images/**")
                .addResourceLocations(
                        "classpath:/static/images/",  // 类路径下的images目录
                        "file:src/main/resources/static/images/"  // 开发环境的绝对路径
                );
    }
}